#ifndef GRAPHMANAGER_H
#define GRAPHMANAGER_H

#include <QVector>
#include <QMap>
#include <QQueue>
#include <graphdata.h>
#include <qcustomplot.h>
#include <layermanager.h>

namespace Graph {

class GraphManager : public QObject
{
    Q_OBJECT
public:

    GraphManager(QCustomPlot * plot, QListWidget * listWidget, QObject * parent = nullptr);

    GraphData *AddNewGraph(const QString &name, const int &coloumn);
    QMap<QString, GraphData *>::iterator DeleteGraph(QMap<QString, GraphData *>::iterator deleteElement);

    void PushTimeGraph(const double &value);
    void ClearData();

    QMap<QString, GraphData *> &GetData();

    const QCPRange &GetTimeRange();
    const QCPRange &GetValueRange();

    void RefreshData();
private:
    QMap<QString, GraphData *> data;
    QVector<double> time;

    QCustomPlot * plot;

    LayerManager Layer;

    QCPRange TimeRange;
    QCPRange ValueRange;

    QListWidget * listWidget;
};

}

#endif // GRAPHMANAGER_H
